package fr.fitec.qcmPlus.actionForms;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class NouveauQuestionnaireForm extends ActionForm{
	
	private static final long serialVersionUID = 1L;
	
    private String libelle 		=	 null; 
	private String description 	=	 null;
	
	
	@Override
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		// TODO Auto-generated method stub
		libelle 		=	 null; 
		description 	=	 null;
	}

	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		
		if(libelle.equals(null) || libelle.length()<2){
			errors.add("libelle", new ActionMessage("nouveauquestionnaire.form.libelle.noncorrect"));
		}
		return errors ; 
	}

	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}
	
	public String getLibelle() {
		return libelle;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getDescription() {
		return description;
	}	
}
